//
//  SYContacter.m
//  SYContactsPicker
//
//  Created by reesun on 15/12/30.
//  Copyright © 2015年 SY. All rights reserved.
//

#import "SDContacter.h"
#include <Availability.h>

@implementation SDContacter

- (NSString *)getContacterName {
    if (_name && _name.length > 0) {
        return _name;
    }
    return @"";
}
- (id)initWithCoder:(NSCoder *)aDecoder
{
    self = [super init];
    if (self) {
        self.name  = [aDecoder decodeObjectForKey:@"name"];
        self.phone = [aDecoder decodeObjectForKey:@"phone"];
        self.email = [aDecoder decodeObjectForKey:@"email"];
        self.txpic = [aDecoder decodeObjectForKey:@"txpic"];
        self.department = [aDecoder decodeObjectForKey:@"department"];
        self.yqNickName = [aDecoder decodeObjectForKey:@"yqNickName"];
        self.pinyingName = [aDecoder decodeObjectForKey:@"pinyingName"];
        self.initial = [aDecoder decodeObjectForKey:@"initial"];
        self.section = [aDecoder decodeIntegerForKey:@"section"];
        self.recordID = [aDecoder decodeIntegerForKey:@"recordID"];
        self.selected = [aDecoder decodeBoolForKey:@"selected"];
        self.type = [aDecoder decodeIntForKey:@"type"];
        self.id = [aDecoder decodeIntForKey:@"id"];
    }
    return self;
}

- (void)encodeWithCoder:(NSCoder *)aCoder
{
    
    [aCoder encodeObject:self.name forKey:@"name"];
    [aCoder encodeObject:self.phone forKey:@"phone"];
    [aCoder encodeObject:self.email forKey:@"email"];
    [aCoder encodeObject:self.txpic forKey:@"txpic"];
    [aCoder encodeObject:self.department forKey:@"department"];
    [aCoder encodeObject:self.yqNickName forKey:@"yqNickName"];
    [aCoder encodeObject:self.pinyingName forKey:@"pinyingName"];
    [aCoder encodeObject:self.initial forKey:@"initial"];
    [aCoder encodeInteger:self.section forKey:@"section"];
    [aCoder encodeInteger:self.recordID forKey:@"recordID"];
    [aCoder encodeBool:self.selected forKey:@"selected"];
    [aCoder encodeInt:self.type forKey:@"type"];
    [aCoder encodeInt:self.id forKey:@"id"];

}
@end
